package com.design.mode.abstractfactory;

import com.design.mode.factory.Shape;

/**
 * @Date 2023/3/29 11:32:41
 * @Author luopeng
 */
public class ColorFactory extends AbstractFactory {

    @Override
    public Shape getShape(String color) {
        return null;
    }

    @Override
    Color getColor(String color) {
        if (Red.class.getSimpleName().equalsIgnoreCase(color)) {
            return new Red();
        } else if (Green.class.getSimpleName().equalsIgnoreCase(color)) {
            return new Green();
        } else if (Blue.class.getSimpleName().equalsIgnoreCase(color)) {
            return new Blue();
        }
        throw new IllegalArgumentException("The factory don't have the color of " + color);
    }
}
